<template>
  <view class="flex align-center justify-between u-p-20 u-m-b-20 bg-white rounded-10" @click="toGroup">
  	<image class="rounded-10" :src="item.goods_images" style="width: 140rpx;height: 140rpx;"></image>
  	<view class="flex-1 flex align-center justify-between u-p-l-15">
  		<view class="flex flex-column justify-between">
  			<view class="">
  				<text class="font-weight-bold">¥{{item.price}}</text>
  				<text class="u-p-l-30 text-greey text-through">¥{{item.line_price}}</text>
  			</view>
  			<text class="u-p-t-10 text-greey">结束时间：{{item.endtime}}</text>
  		</view>
  		<view class="">
				<view class="" v-if="!index" @click.stop="buyGroup">
					<u-tag text="立即抢购" shape="circle" bgColor="" type="warning" mode="dark" ></u-tag>
				</view>
  			<image v-else src="/pages/group/static/group_over.png" style="width: 124rpx;height: 124rpx;" mode=""></image>
  		</view>
  	</view>
  </view>
</template>

<script>
  export default {
    name: "group-goods-item",
    props: {
      index: {
        type: Number,
        default:0
      },
      item: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    data() {
      return {
        
      }
    },
    methods: {
      toGroup() {
				if(this.index == 1) return
      	uni.navigateTo({
      		url: '/pages/group/groupGoodsDetail/groupGoodsDetail?id=' + this.item.id
      	})
      },
			// 发起拼团
			buyGroup() {
				uni.navigateTo({
					url: '/pages/group/groupOrderAdd/groupOrderAdd?groups_goods_id=' + this.item.id
				})
			},
    }
  }
</script>

<style lang="scss" scoped>
</style>
